home *** CD-ROM | disk | FTP | other *** search
- Path: pegasus.montclair.edu!harmon
- From: harmon@pegasus.montclair.edu (Derek Harmon)
- Newsgroups: comp.lang.c
- Subject: Re: Watch out! C "gotcha!"
- Date: 15 Feb 1996 02:35:23 -0500
- Organization: Montclair State University
- Message-ID: <harmon.824368912@pegasus.montclair.edu>
- References: <4fthhh$7th@blackice.winternet.com>
- NNTP-Posting-Host: pegasus.montclair.edu
- X-Newsreader: NN version 6.5.0 #68 (NOV)
-
- mschwarz@winternet.com (Michael Schwarz) writes:
-
- > int x = 1;
- >
- > switch (x)
- > {
- > case 1:
- > printf("It's 1.\n");
- > goto defalt;
- > break;
-
- >It's 1.
- >It's not 1.
-
- >My co-worker came back and said it compiled but there was an unreferenced
- >label warning. Well, of course there was!
-
- Yes, your code illustrates it quite clearly.. if you have something other
- than default (this could also apply to case n, but would more likely be
- reported by a compiler as "cast 1:" would be a syntax error since the label
- expects a colon, except perhaps if your space bar sticks, so "case1:" would
- be a valid label identifier, wherever it might be) followed by a single
- colon wherever, it's a label. You can goto it.
-
- An unreferenced label warning should tell you something, as should syntax
- highlighting (if your editor supports it). Typos kill. :)
- -- Stone
- --
- # Derek Harmon (aka Stonelight) harmon@pegasus.montclair.edu
- # - Computer Science Undergrad, Montclair State University, NJ
- # - My views are my own, nobody else is this creative. 3;)>
- ... Objects in taglines are closer than they appear.
-
-